<template>
    <div class="analysis-container">
        <div class="page-header">
            <router-link class="back-link" to="/main/renshi">
                <i class="el-icon-arrow-left"></i>
                返回
            </router-link>
            <h1>假勤分析</h1>
        </div>

        <div class="content-wrapper">
            <div class="section-header">
                <div class="section-title">
                    <i class="el-icon-data-analysis"></i>
                    <span>考勤数据分析</span>
                </div>
                <div class="section-desc">员工出勤统计与异常分析</div>
            </div>

            <div class="dashboard-grid">
                <!-- 出勤情况 -->
                <div class="stat-section">
                    <div class="section-header">
                        <i class="el-icon-user"></i>
                        <h3>出勤情况</h3>
                    </div>
                    <div class="stat-grid">
                        <div class="stat-card">
                            <div class="stat-icon">
                                <i class="el-icon-user-solid"></i>
                            </div>
                            <div class="stat-content">
                                <div class="stat-value">128</div>
                                <div class="stat-label">应到人数</div>
                            </div>
                        </div>
                        <div class="stat-card">
                            <div class="stat-icon">
                                <i class="el-icon-data-line"></i>
                            </div>
                            <div class="stat-content">
                                <div class="stat-value">96.5%</div>
                                <div class="stat-label">出勤率</div>
                            </div>
                        </div>
                        <div class="stat-card">
                            <div class="stat-icon">
                                <i class="el-icon-time"></i>
                            </div>
                            <div class="stat-content">
                                <div class="stat-value">8.2h</div>
                                <div class="stat-label">平均工时</div>
                            </div>
                        </div>
                        <div class="stat-card">
                            <div class="stat-icon">
                                <i class="el-icon-check"></i>
                            </div>
                            <div class="stat-content">
                                <div class="stat-value">125</div>
                                <div class="stat-label">打卡人数</div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 异常情况 -->
                <div class="stat-section">
                    <div class="section-header">
                        <i class="el-icon-warning"></i>
                        <h3>异常情况</h3>
                    </div>
                    <div class="stat-grid">
                        <div class="stat-card warning">
                            <div class="stat-icon">
                                <i class="el-icon-document"></i>
                            </div>
                            <div class="stat-content">
                                <div class="stat-value">5</div>
                                <div class="stat-label">请假人数</div>
                            </div>
                        </div>
                        <div class="stat-card warning">
                            <div class="stat-icon">
                                <i class="el-icon-timer"></i>
                            </div>
                            <div class="stat-content">
                                <div class="stat-value">3</div>
                                <div class="stat-label">迟到人数</div>
                            </div>
                        </div>
                        <div class="stat-card warning">
                            <div class="stat-icon">
                                <i class="el-icon-alarm-clock"></i>
                            </div>
                            <div class="stat-content">
                                <div class="stat-value">8</div>
                                <div class="stat-label">加班人数</div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 统计图表 -->
                <div class="stat-section full-width">
                    <div class="section-header">
                        <i class="el-icon-trend-charts"></i>
                        <h3>统计图表</h3>
                    </div>
                    <div class="chart-container">
                        <div class="chart-placeholder">
                            <i class="el-icon-data-line"></i>
                            <span>近期考勤趋势分析图表</span>
                        </div>
                    </div>
                </div>

                <!-- 原有卡片内容 -->
                <div class="stat-section full-width">
                    <div class="section-header">
                        <i class="el-icon-menu"></i>
                        <h3>详细分析</h3>
                    </div>
                    <div class="category-container">
                        <div class="category">
                            <h3 class="category-title">出勤情况</h3>
                            <div class="item-group">
                                <span class="analysis-item">应到人数</span>
                                <span class="analysis-item">出勤率</span>
                                <span class="analysis-item">平均工时</span>
                                <span class="analysis-item">打卡人数</span>
                            </div>
                        </div>
                        <div class="category">
                            <h3 class="category-title">异常情况</h3>
                            <div class="item-group">
                                <span class="analysis-item">请假人数</span>
                                <span class="analysis-item">迟到人数</span>
                                <span class="analysis-item">加班人数</span>
                            </div>
                        </div>
                        <div class="category">
                            <h3 class="category-title">统计图表</h3>
                            <div class="item-group">
                                <span class="analysis-item">近期趋势图</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<style lang="scss" scoped>
.analysis-container {
    min-height: 100vh;
    // background-color: #f5f7fa;
    padding: 20px;
    box-sizing: border-box;

    .page-header {
        display: flex;
        align-items: center;
        margin-bottom: 24px;
        background-color: #fff;
        padding: 16px 24px;
        border-radius: 8px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);

        .back-link {
            display: flex;
            align-items: center;
            text-decoration: none;
            color: #409EFF;
            font-size: 14px;
            margin-right: 20px;
            transition: all 0.3s;

            i {
                margin-right: 5px;
            }

            &:hover {
                opacity: 0.8;
            }
        }

        h1 {
            margin: 0;
            font-size: 20px;
            font-weight: 500;
            color: #303133;
        }
    }

    .content-wrapper {
        background-color: #fff;
        border-radius: 8px;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1), 0 6px 6px rgba(0, 0, 0, 0.1);
        padding: 32px;

        .section-header {
            text-align: center;
            margin-bottom: 40px;

            .section-title {
                display: inline-flex;
                align-items: center;
                background: linear-gradient(135deg, #409EFF, #66b1ff);
                color: white;
                padding: 12px 24px;
                border-radius: 10px;
                margin-bottom: 16px;
                box-shadow: 0 4px 12px rgba(64, 158, 255, 0.2);

                i {
                    margin-right: 8px;
                    font-size: 20px;
                }

                span {
                    font-size: 18px;
                    font-weight: 500;
                }
            }

            .section-desc {
                color: #909399;
                font-size: 14px;
            }
        }

        .dashboard-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 24px;

            .stat-section {
                background-color: #f5f7fa;
                border-radius: 8px;
                padding: 20px;
                border: 1px solid #ebeef5;

                &.full-width {
                    grid-column: 1 / -1;
                }

                .section-header {
                    display: flex;
                    align-items: center;
                    margin-bottom: 20px;
                    text-align: left;

                    i {
                        font-size: 20px;
                        color: #409EFF;
                        margin-right: 8px;
                    }

                    h3 {
                        margin: 0;
                        font-size: 16px;
                        font-weight: 500;
                        color: #303133;
                    }
                }

                .stat-grid {
                    display: grid;
                    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
                    gap: 16px;

                    .stat-card {
                        background: white;
                        border-radius: 8px;
                        padding: 16px;
                        display: flex;
                        align-items: center;
                        transition: all 0.3s ease;

                        &:hover {
                            transform: translateY(-5px);
                            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
                        }

                        &.warning {
                            .stat-icon {
                                background: linear-gradient(135deg, #f56c6c, #f78989);
                            }
                        }

                        .stat-icon {
                            width: 40px;
                            height: 40px;
                            border-radius: 8px;
                            background: linear-gradient(135deg, #409EFF, #66b1ff);
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            margin-right: 12px;

                            i {
                                font-size: 20px;
                                color: white;
                            }
                        }

                        .stat-content {
                            .stat-value {
                                font-size: 20px;
                                font-weight: 600;
                                color: #303133;
                                margin-bottom: 4px;
                            }

                            .stat-label {
                                font-size: 12px;
                                color: #909399;
                            }
                        }
                    }
                }

                .chart-container {
                    background: white;
                    border-radius: 8px;
                    height: 300px;
                    display: flex;
                    align-items: center;
                    justify-content: center;

                    .chart-placeholder {
                        text-align: center;
                        color: #909399;

                        i {
                            font-size: 48px;
                            margin-bottom: 12px;
                            display: block;
                        }

                        span {
                            font-size: 14px;
                        }
                    }
                }

                // 原有卡片样式
                .category-container {
                    width: 100%;
                    margin-top: 20px;

                    .category {
                        margin-bottom: 24px;

                        &:last-child {
                            margin-bottom: 0;
                        }

                        .category-title {
                            font-size: 14px;
                            font-weight: 500;
                            color: #303133;
                            margin-bottom: 16px;
                            padding-bottom: 8px;
                            border-bottom: 1px solid #ebeef5;
                        }

                        .item-group {
                            display: grid;
                            grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
                            gap: 16px;

                            .analysis-item {
                                background: white;
                                padding: 12px 16px;
                                border-radius: 8px;
                                text-align: center;
                                color: #606266;
                                font-size: 14px;
                                border: 1px solid #ebeef5;
                                transition: all 0.3s ease;

                                &:hover {
                                    transform: translateY(-3px);
                                    background-color: #ecf5ff;
                                    border-color: #409EFF;
                                    color: #409EFF;
                                    box-shadow: 0 4px 12px rgba(64, 158, 255, 0.1);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

@media screen and (max-width: 768px) {
    .analysis-container {
        padding: 12px;

        .page-header {
            padding: 12px 16px;
        }

        .content-wrapper {
            padding: 20px 16px;

            .section-header {
                margin-bottom: 24px;

                .section-title {
                    padding: 8px 16px;
                    
                    i {
                        font-size: 18px;
                    }

                    span {
                        font-size: 16px;
                    }
                }
            }

            .dashboard-grid {
                grid-template-columns: 1fr;
                gap: 16px;

                .stat-section {
                    padding: 16px;

                    .stat-grid {
                        grid-template-columns: repeat(2, 1fr);
                        gap: 12px;

                        .stat-card {
                            padding: 12px;

                            .stat-icon {
                                width: 32px;
                                height: 32px;

                                i {
                                    font-size: 16px;
                                }
                            }

                            .stat-content {
                                .stat-value {
                                    font-size: 16px;
                                }

                                .stat-label {
                                    font-size: 11px;
                                }
                            }
                        }
                    }

                    .chart-container {
                        height: 200px;

                        .chart-placeholder {
                            i {
                                font-size: 36px;
                            }

                            span {
                                font-size: 12px;
                            }
                        }
                    }

                    .category-container {
                        .category {
                            .item-group {
                                grid-template-columns: repeat(2, 1fr);
                                gap: 12px;

                                .analysis-item {
                                    padding: 10px;
                                    font-size: 13px;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
</style>